package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDate;

/**
 * 用户实体类
 */
@TableName("t_user")  //该实体类映射的表名
public class UserBean {
    //该属性映射的是数据库表的主键列
    //value表示映射主键列的列名。type表示主键生成策略。
    // IdType.AUTO 利用数据库表的自动增长列，生成主键列的值
    @TableId(value = "pk_userId",type = IdType.AUTO)
    private Integer id;
    @TableField("u_name") //该属性映射哪个普通列
    private String name;
    @TableField("u_pwd")
    private String pwd;
    @TableField("u_birthday")
    private LocalDate birthday;
    @TableField("u_money")
    private Integer money;

    public UserBean(String name, String pwd, LocalDate birthday, Integer money) {
        this.name = name;
        this.pwd = pwd;
        this.birthday = birthday;
        this.money = money;
    }

    public UserBean() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public LocalDate getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDate birthday) {
        this.birthday = birthday;
    }

    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }

    @Override
    public String toString() {
        return "UserBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", pwd='" + pwd + '\'' +
                ", birthday=" + birthday +
                ", money=" + money +
                "}\n";
    }
}
